package com.bite.messageQueue.mqClient;

import java.io.IOException;

/**
 * 是消息队列（MQ）客户端中用于创建和管理与服务器物理连接的核心工厂类
 */
public class ConnectionFactory {
    //broker server 的ip地址
    private String host;
    //broker server端口号
    private int port;

    //private String virtualHostName;

    //创建并返回与消息队列服务器的物理连接对象
    public Connection newConnection() throws IOException {
        Connection connection = new Connection(host,port);
        return connection;
    }

    /**
     * 获取
     * @return host
     */
    public String getHost() {
        return host;
    }

    /**
     * 设置
     * @param host
     */
    public void setHost(String host) {
        this.host = host;
    }

    /**
     * 获取
     * @return port
     */
    public int getPort() {
        return port;
    }

    /**
     * 设置
     * @param port
     */
    public void setPort(int port) {
        this.port = port;
    }

    @Override
    public String toString() {
        return "ConnectionFactory{host = " + host + ", port = " + port + "}";
    }
}
